<!--
 * @FilePath     : /study_code/vue2.x/api/vue.directive copy.html
 * @Description  : Vue.directive 定义自定义指令的使用
 * @Date         : 2025-05-06 09:23:51
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-05-06 09:23:51
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <div id="app">
      <div id="hook-arguments-example" v-demo:foo.a.b="msg">{{ msg }}</div>
    </div>

    <script src="/vue/dist/vue.min.js"></script>
    <script src="./common.js"></script>
    <script>
      // 全局-自定义指令
      Vue.directive('demo', {
        bind: function (el, binding, vnode, oldValue) {},
        inserted: function (el, binding, vnode, oldValue) {
          console.log('钩子-inserted', el, binding, vnode, oldValue)
        },
        componentUpdated: function (el, binding, vnode, oldValue) {},
        unbind: function (el, binding, vnode, oldValue) {},
      })

      var app = new Vue({
        el: '#app',
        data: function () {
          return { msg: 'hello!' }
        },
      })
    </script>
  </body>
</html>
